<extend name="Public:layout"/>
<block name="content">
    <div class="panel admin-panel">
        <div class="panel-head"><strong class="icon-reorder"> 文章列表</strong></div>
        <div class="container-fluid">
            <div class="row padding">
                <form action="{:U('')}" method="post" class="form-inline">
                    <div class="form-group">
                        <label>标题</label>
                        <input type="text" class="form-control" name="like[title]" value="{$map.like.title}">
                    </div>
                    <div class="form-group">
                        <label>分类</label>
                        <select name="category_id" class="form-control">
                            <option value="">全部</option>
                            <foreach name="category" item="vo" key="key">
                                <option value="{$key}" <eq name="key" value="$map['category_id']">selected</eq>>{$vo}</option>
                            </foreach>
                        </select>
                    </div>
                    <button type="submit" class="btn btn-primary"> 搜索</button>
                </form>
            </div>
            <div class="clearfix"></div>
            <div class="row padding">
                <a class="btn btn-primary icon-plus" href="{:U('edit')}"> 添加文章</a>
                <!--<a type="button" href="javascript:void(0)" class="btn btn-primary icon-sort sort-list">排序</a>-->
            </div>
        </div>

        <table class="table table-hover text-center">
            <thead>
            <tr>
                <th width="100" style="text-align:left; padding-left:20px;">ID</th>
                <!--<th width="100">排序</th>-->
                <th>标题</th>
                <!--<th>站点</th>-->
                <th>分类</th>
                <th>来源</th>
                <th>作者</th>
                <th>缩略图</th>
                <th>置顶</th>
                <th>推荐</th>
                <th>状态</th>
                <th width="310">操作</th>
            </tr>
            </thead>
            <tbody>
            <volist name="list" id="vo">
                <tr>
                    <td style="text-align:left; padding-left:20px;">{$vo.article_id}</td>
                    <!--<td><input type="text" class="form-control sort-input" value="{$vo.sort}" pk="{$vo.article_id}"></td>-->
                    <td>{$vo.title}</td>
                    <!--<td>{$vo.website|join=",", ###}</td>-->
                    <td>{$vo.category|join="<br/>", ###}</td>
                    <td>{$vo.source}</td>
                    <td>{$vo.author}</td>
                    <td>
                        <!--<a href="{:U('thumb', 'article_id='.$vo['article_id'])}" class="btn btn-primary">设置缩略图</a>-->
                        <img src="{$vo.thumb}" style="max-width:100px;" alt="">
                    </td>
                    <td>
                        <eq name="vo.top" value="1">
                            <a class="btn btn-success ajax-click" data-url="{:U('top', 'status=0&article_id='.$vo['article_id'])}">取消置顶</a>
                            <else/>
                            <a class="btn btn-default ajax-click" data-url="{:U('top', 'status=1&article_id='.$vo['article_id'])}">设置置顶</a>
                        </eq>
                    </td>
                    <td>
                        <eq name="vo.recommend" value="1">
                            <a class="btn btn-success ajax-click" data-url="{:U('recommend', 'status=0&article_id='.$vo['article_id'])}">取消推荐</a>
                            <else/>
                            <a class="btn btn-default ajax-click" data-url="{:U('recommend', 'status=1&article_id='.$vo['article_id'])}">设置推荐</a>
                        </eq>
                    </td>
                    <td>
                        {$vo['status'] ? '<div class="btn btn-info">正常</div>':'<div class="btn btn-danger">禁用</div>'}

                    </td>
                    <td>
                        <div class="btn-group">
                            <a class="btn btn-primary" href="{:U('edit', 'article_id='.$vo['article_id'])}"><span class="icon-edit"></span> 修改</a>
                            <a class="btn btn-info ajax-click" href="javascript:void(0)" data-url="{:U('ban', 'article_id='.$vo['article_id'].'&status='.!$vo['status'])}"><span class="icon-edit"></span> {$vo['status'] ? '禁用' : '启用'}</a>
                            <a class="btn btn-danger ajax-click" href="javascript:void(0)" data-url="{:U('del', 'article_id='.$vo['article_id'])}"><span class="icon-trash-o"></span> 删除</a>
                        </div>
                    </td>
                </tr>
            </volist>
            </tbody>
            <tfoot>
            <tr>
                <td colspan="20"><div class="pagelist"> {$page} </div></td>
            </tr>
            </tfoot>
        </table>
    </div>
</block>